package com.eedi.framework.permission.enums;

import com.eedi.framework.common.enums.BaseEnum;
import com.eedi.framework.common.util.object.ObjectUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

/**
 * 角色标识枚举
 */
@Getter
@AllArgsConstructor
@ToString
public enum OrgRoleCodeEnum implements BaseEnum<String,String> {

    IMPL_ADMIN("impl_admin", "超级管理员"),
    SYS_ADMIN("sys_admin", "租户管理员"),
    ORG_ADMIN("org_admin", "机构管理员"),
    DEFAULT("default","默认")
    ;

    /**
     * 角色编码
     */
    private final String code;
    /**
     * 名字
     */
    private final String desc;

    public static boolean isImplAdmin(String code) {
        return ObjectUtils.equalsAny(code, IMPL_ADMIN.getCode());
    }

    public static boolean isSysAdmin(String code) {
        return ObjectUtils.equalsAny(code, SYS_ADMIN.getCode());
    }

    public static boolean isOrgAdmin(String code) {
        return ObjectUtils.equalsAny(code, ORG_ADMIN.getCode());
    }

    @Override
    public String title() {
        return "机构角色标识";
    }
}
